Bug: CEL Expressions tab crashes and hidden menus reset on upgrade#166
Bug: CEL Expressions tab crashes and hidden menus reset on upgrade#166
Conversation
1. spp_approval: change ace widget mode from 'text' to 'python' in CEL expression fields. Odoo 19 CodeEditor only accepts javascript/xml/qweb/scss/python — 'text' crashes with "Invalid props for component 'CodeEditor': 'mode' is not valid". 2. spp_hide_menus_base: re-apply hiding when module upgrade resets menu group_ids via XML (noupdate="0"). Previously, menus with state="hide" were skipped in hide_menus(), so an upgrade that re-applied the original group_ids left them visible. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request modifies the ace widget configuration for CEL fields to use python mode and adds logic to re-apply menu hiding settings during module upgrades. The reviewer recommends using javascript mode instead of python for CEL expressions to ensure correct syntax highlighting, as CEL's syntax aligns more closely with JavaScript.
| name="cel_condition" | ||
| widget="ace" | ||
| options="{'mode': 'text'}" | ||
| options="{'mode': 'python'}" |
There was a problem hiding this comment.
CEL (Common Expression Language) uses C-style operators such as &&, ||, and !, which are not valid in Python. Using python mode will cause the CodeEditor to highlight these as syntax errors, leading to a poor user experience. Since Odoo 19's CodeEditor supports javascript, it is a much better fit for CEL expressions as the syntax is largely compatible.
| options="{'mode': 'python'}" | |
| options="{'mode': 'javascript'}" |
| name="cel_reviewer_expression" | ||
| widget="ace" | ||
| options="{'mode': 'text'}" | ||
| options="{'mode': 'python'}" |
There was a problem hiding this comment.
CEL (Common Expression Language) uses C-style operators such as &&, ||, and !, which are not valid in Python. Using python mode will cause the CodeEditor to highlight these as syntax errors, leading to a poor user experience. Since Odoo 19's CodeEditor supports javascript, it is a much better fit for CEL expressions as the syntax is largely compatible.
| options="{'mode': 'python'}" | |
| options="{'mode': 'javascript'}" |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 19.0 #166 +/- ##
==========================================
+ Coverage 71.45% 71.46% +0.01%
==========================================
Files 932 932
Lines 54792 54846 +54
==========================================
+ Hits 39152 39198 +46
- Misses 15640 15648 +8
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
1. CodeEditor crash on Approval Definition CEL Expressions tab
Steps to reproduce:
Expected: Tab opens normally
Actual: JS crash:
Invalid props for component 'CodeEditor': 'mode' is not validRoot cause:
spp_approval/views/approval_definition_views_cel.xmlusesoptions="{'mode': 'text'}"onwidget="ace"fields. Odoo 19'sCodeEditorcomponent only accepts modes:javascript,xml,qweb,scss,python.textis not a valid mode.2. Hidden menus become visible after module upgrade
Steps to reproduce:
Root cause: Module upgrade re-applies menu XML data (
noupdate="0"), resettinggroup_ids. Thehide_menus()hook inir.module.module.next()skips menus withstate="hide", so the reset is never corrected.